﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CAD.BLL;
using CAD.DTO;

namespace WFASmartketing.REPORTES
{
    public partial class ReporteMovimientoBancoWF : Form
    {
        public ReporteMovimientoBancoWF()
        {
            InitializeComponent();
            cbxbanco.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxmovimiento.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxmovimiento.SelectedIndex = 0;
            cargarBanco();
         
        }

        private void ReporteMovimientoBancoWF_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'ReporteMovimientoBancoDS.reporte_movimientobanco' table. You can move, or remove it, as needed.
            RECARGARGRID();
        }
        private void RECARGARGRID() {
            string BANCO = "";
            string MOVIMIENTO = "";
            if (cbxbanco.SelectedText.ToString().Equals("TODOS"))
            {
                BANCO = "%%";
            }
            else {
                BANCO = cbxbanco.Text.ToString();
            }
            if (cbxmovimiento.SelectedItem.ToString().Equals("TODOS"))
            {
                MOVIMIENTO = "%%";
            }
            else
            {
                MOVIMIENTO = cbxmovimiento.SelectedItem.ToString();
            }
            DateTime ini = dtcini.Value;
            DateTime fin = dtcfin.Value;
            this.reporte_movimientobancoTableAdapter.Fill(this.ReporteMovimientoBancoDS.reporte_movimientobanco,ini,fin,BANCO,MOVIMIENTO);
            this.reportViewer1.RefreshReport();
        }
        private void cargarBanco()
        {
            List<banco> listacajas = bancoBLL.SelectAll();
            cbxbanco.DataSource = listacajas;
            cbxbanco.DisplayMember = "Nombre";
            cbxbanco.ValueMember = "Id";
        }
      
        private void button2_Click(object sender, EventArgs e)
        {
            RECARGARGRID();
        }

        private void cbxbanco_SelectionChangeCommitted(object sender, EventArgs e)
        {
            
        }

        private void cbxbanco_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
